package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import javax.swing.JButton;

import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;

import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VistaCalendario extends javax.swing.JFrame {
	private JPanel panCalendario;
	private JButton btnSalir;
	private JLabel lblTitulo;
	private JTable tblCalendario;
	private JScrollPane scpListado;
	private JButton btnVerGoleadores;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public VistaCalendario() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panCalendario = new JPanel();
				getContentPane().add(panCalendario, BorderLayout.CENTER);
				panCalendario.setLayout(null);
				panCalendario.setPreferredSize(new java.awt.Dimension(492, 325));
				setTitle("Resultados del Torneo");
				{
					scpListado = new JScrollPane();
					panCalendario.add(scpListado);
					scpListado.setBounds(18, 41, 462, 216);
					{
						tblCalendario = new JTable();
						scpListado.setViewportView(tblCalendario);
					}
				}
				{
					lblTitulo = new JLabel();
					panCalendario.add(lblTitulo);
					lblTitulo.setText("Calendario");
					lblTitulo.setBounds(168, 13, 153, 16);
					lblTitulo.setAlignmentX(0.5f);
					lblTitulo.setHorizontalAlignment(SwingConstants.CENTER);
				}
				{
					btnSalir = new JButton();
					panCalendario.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(412, 284, 69, 22);
				}
				{
					btnVerGoleadores = new JButton();
					panCalendario.add(btnVerGoleadores);
					btnVerGoleadores.setText("Ver Goleadores");
					btnVerGoleadores.setBounds(180, 269, 131, 23);
				}
			}
			pack();
			this.setSize(502, 366);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void setModeloDeTabla(TableModel modelo){
		tblCalendario.setModel(modelo);
	}
	
	public void agregarListener(ActionListener accion){
		btnSalir.addActionListener(accion);
		btnVerGoleadores.addActionListener(accion);
	}
	
	public int celdaSeleccionada(){
		return tblCalendario.getSelectedRow();
	}
	
	public void tirarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}

}
